﻿using System; 
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic; 
using System.Data;
using DBUtility;

namespace XQ.SP.DalServices  
{
	 	//个性设置
		public partial class ShopUserSetDal : BaseDal
	{
   		     
		public bool ExistsWhere(string whereSql)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from ShopUserSet");
            if (whereSql != "")
            {
                strSql.Append(" where " + whereSql);
            }
			
			return DbHelperSQL.Exists(strSql.ToString());
		}
		public bool Exists(long id)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from [ShopUserSet]");
			strSql.Append(" where  [Id]=@Id ");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = id;
			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}
		
				
		
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public long Add(XQ.SP.Model.ShopUserSetItem model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into [ShopUserSet](");			
            strSql.Append("[UserInfoId],[WebName],[Keys],[Description],[Logo],[BackColor],[Url],[RealName],[BankName],[BankStartPlace],[BankNo],[Level],[Status],[Creator],[Created],[Modifier],[Modified],[OfficePhone],[Telephone],[WeChat],[QqGroup],[QQ],[IdImage],[IdCard],[Tele400],[NoPublic],[QQ1],[QQ2],[QQ3],[T1],[T2],[T3],[T4],[T5]");
			strSql.Append(") values (");
            strSql.Append("@UserInfoId,@WebName,@Keys,@Description,@Logo,@BackColor,@Url,@RealName,@BankName,@BankStartPlace,@BankNo,@Level,@Status,@Creator,@Created,@Modifier,@Modified,@OfficePhone,@Telephone,@WeChat,@QqGroup,@QQ,@IdImage,@IdCard,@Tele400,@NoPublic,@QQ1,@QQ2,@QQ3,@T1,@T2,@T3,@T4,@T5");            
            strSql.Append(") ");            
            strSql.Append(";select @@IDENTITY");		
			SqlParameter[] parameters = {
			            new SqlParameter("@UserInfoId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@WebName", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@Keys", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@Description", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@Logo", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BackColor", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Url", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@RealName", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BankName", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BankStartPlace", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BankNo", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Level", SqlDbType.Int,4) ,            
                        new SqlParameter("@Status", SqlDbType.Int,4) ,            
                        new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Created", SqlDbType.DateTime) ,            
                        new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Modified", SqlDbType.DateTime) ,            
                        new SqlParameter("@OfficePhone", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Telephone", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@WeChat", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QqGroup", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@IdImage", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@IdCard", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Tele400", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@NoPublic", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ1", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ2", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ3", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T1", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T2", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T3", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T4", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T5", SqlDbType.NVarChar,200)             
              
            };
			            
            parameters[0].Value = model.UserInfoId;                        
            parameters[1].Value = model.WebName;                        
            parameters[2].Value = model.Keys;                        
            parameters[3].Value = model.Description;                        
            parameters[4].Value = model.Logo;                        
            parameters[5].Value = model.BackColor;                        
            parameters[6].Value = model.Url;                        
            parameters[7].Value = model.RealName;                        
            parameters[8].Value = model.BankName;                        
            parameters[9].Value = model.BankStartPlace;                        
            parameters[10].Value = model.BankNo;                        
            parameters[11].Value = model.Level;                        
            parameters[12].Value = model.Status;                        
            parameters[13].Value = model.Creator;                        
            parameters[14].Value = model.Created;                        
            parameters[15].Value = model.Modifier;                        
            parameters[16].Value = model.Modified;                        
            parameters[17].Value = model.OfficePhone;                        
            parameters[18].Value = model.Telephone;                        
            parameters[19].Value = model.WeChat;                        
            parameters[20].Value = model.QqGroup;                        
            parameters[21].Value = model.QQ;                        
            parameters[22].Value = model.IdImage;                        
            parameters[23].Value = model.IdCard;                        
            parameters[24].Value = model.Tele400;                        
            parameters[25].Value = model.NoPublic;                        
            parameters[26].Value = model.QQ1;                        
            parameters[27].Value = model.QQ2;                        
            parameters[28].Value = model.QQ3;                        
            parameters[29].Value = model.T1;                        
            parameters[30].Value = model.T2;                        
            parameters[31].Value = model.T3;                        
            parameters[32].Value = model.T4;                        
            parameters[33].Value = model.T5;                        
			   
			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);			
			if (obj == null)
			{
				return 0;
			}
			else
			{
				                                    
            	return Convert.ToInt64(obj);
                                                  
			}			   
            			
		}
		
		/// <summary>
		///   批量添加数据
		/// </summary>
		public int AddList(List<XQ.SP.Model.ShopUserSetItem> models)
		{
			List<CommandInfo> commands = new List<CommandInfo>();
			foreach(XQ.SP.Model.ShopUserSetItem item in models)
			{
				CommandInfo command = new CommandInfo();
				StringBuilder strSql=new StringBuilder();
				strSql.Append("insert into [ShopUserSet](");			
	            strSql.Append("[UserInfoId],[WebName],[Keys],[Description],[Logo],[BackColor],[Url],[RealName],[BankName],[BankStartPlace],[BankNo],[Level],[Status],[Creator],[Created],[Modifier],[Modified],[OfficePhone],[Telephone],[WeChat],[QqGroup],[QQ],[IdImage],[IdCard],[Tele400],[NoPublic],[QQ1],[QQ2],[QQ3],[T1],[T2],[T3],[T4],[T5]");
				strSql.Append(") values (");
	            strSql.Append("@UserInfoId,@WebName,@Keys,@Description,@Logo,@BackColor,@Url,@RealName,@BankName,@BankStartPlace,@BankNo,@Level,@Status,@Creator,@Created,@Modifier,@Modified,@OfficePhone,@Telephone,@WeChat,@QqGroup,@QQ,@IdImage,@IdCard,@Tele400,@NoPublic,@QQ1,@QQ2,@QQ3,@T1,@T2,@T3,@T4,@T5");            
	            strSql.Append(") ");            
	            strSql.Append(";select @@IDENTITY");		
				SqlParameter[] parameters = {
					            new SqlParameter("@UserInfoId", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@WebName", SqlDbType.NVarChar,500) ,            
	            	            new SqlParameter("@Keys", SqlDbType.NVarChar,500) ,            
	            	            new SqlParameter("@Description", SqlDbType.NVarChar,1000) ,            
	            	            new SqlParameter("@Logo", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@BackColor", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@Url", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@RealName", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@BankName", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@BankStartPlace", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@BankNo", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@Level", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Status", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@Created", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@Modified", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@OfficePhone", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@Telephone", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@WeChat", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@QqGroup", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@QQ", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@IdImage", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@IdCard", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@Tele400", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@NoPublic", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@QQ1", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@QQ2", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@QQ3", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@T1", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@T2", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@T3", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@T4", SqlDbType.NVarChar,200) ,            
	            	            new SqlParameter("@T5", SqlDbType.NVarChar,200)             
	              
	            };
	            				            
	            parameters[0].Value = item.UserInfoId;	                        
	            parameters[1].Value = item.WebName;	                        
	            parameters[2].Value = item.Keys;	                        
	            parameters[3].Value = item.Description;	                        
	            parameters[4].Value = item.Logo;	                        
	            parameters[5].Value = item.BackColor;	                        
	            parameters[6].Value = item.Url;	                        
	            parameters[7].Value = item.RealName;	                        
	            parameters[8].Value = item.BankName;	                        
	            parameters[9].Value = item.BankStartPlace;	                        
	            parameters[10].Value = item.BankNo;	                        
	            parameters[11].Value = item.Level;	                        
	            parameters[12].Value = item.Status;	                        
	            parameters[13].Value = item.Creator;	                        
	            parameters[14].Value = item.Created;	                        
	            parameters[15].Value = item.Modifier;	                        
	            parameters[16].Value = item.Modified;	                        
	            parameters[17].Value = item.OfficePhone;	                        
	            parameters[18].Value = item.Telephone;	                        
	            parameters[19].Value = item.WeChat;	                        
	            parameters[20].Value = item.QqGroup;	                        
	            parameters[21].Value = item.QQ;	                        
	            parameters[22].Value = item.IdImage;	                        
	            parameters[23].Value = item.IdCard;	                        
	            parameters[24].Value = item.Tele400;	                        
	            parameters[25].Value = item.NoPublic;	                        
	            parameters[26].Value = item.QQ1;	                        
	            parameters[27].Value = item.QQ2;	                        
	            parameters[28].Value = item.QQ3;	                        
	            parameters[29].Value = item.T1;	                        
	            parameters[30].Value = item.T2;	                        
	            parameters[31].Value = item.T3;	                        
	            parameters[32].Value = item.T4;	                        
	            parameters[33].Value = item.T5;	            	            
	         	command.CommandText = strSql.ToString();
	         	command.Parameters = parameters;
	         	
	         	commands.Add(command);
	         }
            
			object obj = DbHelperSQL.ExecuteSqlTran(commands);			
			if (obj == null)
			{
				return 0;
			}
			else
			{
            	return Convert.ToInt32(obj);
			}
			
           
		}
		
		
		/// <summary>
		/// 批量更新数据
		/// </summary>
		public int UpdateList(List<XQ.SP.Model.ShopUserSetItem> models)
		{
			List<CommandInfo> commands = new List<CommandInfo>();
			CommandInfo command = new CommandInfo();
			
			foreach(XQ.SP.Model.ShopUserSetItem item in models)
			{
					StringBuilder strSql=new StringBuilder();
					strSql.Append("update [ShopUserSet] set ");
							            		            		                        
		            strSql.Append(" [UserInfoId] = @UserInfoId , ");		            		                        
		            strSql.Append(" [WebName] = @WebName , ");		            		                        
		            strSql.Append(" [Keys] = @Keys , ");		            		                        
		            strSql.Append(" [Description] = @Description , ");		            		                        
		            strSql.Append(" [Logo] = @Logo , ");		            		                        
		            strSql.Append(" [BackColor] = @BackColor , ");		            		                        
		            strSql.Append(" [Url] = @Url , ");		            		                        
		            strSql.Append(" [RealName] = @RealName , ");		            		                        
		            strSql.Append(" [BankName] = @BankName , ");		            		                        
		            strSql.Append(" [BankStartPlace] = @BankStartPlace , ");		            		                        
		            strSql.Append(" [BankNo] = @BankNo , ");		            		                        
		            strSql.Append(" [Level] = @Level , ");		            		                        
		            strSql.Append(" [Status] = @Status , ");		            		                        
		            strSql.Append(" [Creator] = @Creator , ");		            		                        
		            strSql.Append(" [Created] = @Created , ");		            		                        
		            strSql.Append(" [Modifier] = @Modifier , ");		            		                        
		            strSql.Append(" [Modified] = @Modified , ");		            		                        
		            strSql.Append(" [OfficePhone] = @OfficePhone , ");		            		                        
		            strSql.Append(" [Telephone] = @Telephone , ");		            		                        
		            strSql.Append(" [WeChat] = @WeChat , ");		            		                        
		            strSql.Append(" [QqGroup] = @QqGroup , ");		            		                        
		            strSql.Append(" [QQ] = @QQ , ");		            		                        
		            strSql.Append(" [IdImage] = @IdImage , ");		            		                        
		            strSql.Append(" [IdCard] = @IdCard , ");		            		                        
		            strSql.Append(" [Tele400] = @Tele400 , ");		            		                        
		            strSql.Append(" [NoPublic] = @NoPublic , ");		            		                        
		            strSql.Append(" [QQ1] = @QQ1 , ");		            		                        
		            strSql.Append(" [QQ2] = @QQ2 , ");		            		                        
		            strSql.Append(" [QQ3] = @QQ3 , ");		            		                        
		            strSql.Append(" [T1] = @T1 , ");		            		                        
		            strSql.Append(" [T2] = @T2 , ");		            		                        
		            strSql.Append(" [T3] = @T3 , ");		            		                        
		            strSql.Append(" [T4] = @T4 , ");		            		                        
		            strSql.Append(" [T5] = @T5  ");		            			
					strSql.Append(" where [Id]=@Id ");
								
					SqlParameter[] parameters = {
							            new SqlParameter("@Id", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@UserInfoId", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@WebName", SqlDbType.NVarChar,500) ,		            
		            		            new SqlParameter("@Keys", SqlDbType.NVarChar,500) ,		            
		            		            new SqlParameter("@Description", SqlDbType.NVarChar,1000) ,		            
		            		            new SqlParameter("@Logo", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@BackColor", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@Url", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@RealName", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@BankName", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@BankStartPlace", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@BankNo", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@Level", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Status", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Creator", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@Created", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@Modified", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@OfficePhone", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@Telephone", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@WeChat", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@QqGroup", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@QQ", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@IdImage", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@IdCard", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@Tele400", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@NoPublic", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@QQ1", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@QQ2", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@QQ3", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@T1", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@T2", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@T3", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@T4", SqlDbType.NVarChar,200) ,		            
		            		            new SqlParameter("@T5", SqlDbType.NVarChar,200) 		            
		              
		            };
		            					            
		            parameters[0].Value = item.Id;		                        
		            parameters[1].Value = item.UserInfoId;		                        
		            parameters[2].Value = item.WebName;		                        
		            parameters[3].Value = item.Keys;		                        
		            parameters[4].Value = item.Description;		                        
		            parameters[5].Value = item.Logo;		                        
		            parameters[6].Value = item.BackColor;		                        
		            parameters[7].Value = item.Url;		                        
		            parameters[8].Value = item.RealName;		                        
		            parameters[9].Value = item.BankName;		                        
		            parameters[10].Value = item.BankStartPlace;		                        
		            parameters[11].Value = item.BankNo;		                        
		            parameters[12].Value = item.Level;		                        
		            parameters[13].Value = item.Status;		                        
		            parameters[14].Value = item.Creator;		                        
		            parameters[15].Value = item.Created;		                        
		            parameters[16].Value = item.Modifier;		                        
		            parameters[17].Value = item.Modified;		                        
		            parameters[18].Value = item.OfficePhone;		                        
		            parameters[19].Value = item.Telephone;		                        
		            parameters[20].Value = item.WeChat;		                        
		            parameters[21].Value = item.QqGroup;		                        
		            parameters[22].Value = item.QQ;		                        
		            parameters[23].Value = item.IdImage;		                        
		            parameters[24].Value = item.IdCard;		                        
		            parameters[25].Value = item.Tele400;		                        
		            parameters[26].Value = item.NoPublic;		                        
		            parameters[27].Value = item.QQ1;		                        
		            parameters[28].Value = item.QQ2;		                        
		            parameters[29].Value = item.QQ3;		                        
		            parameters[30].Value = item.T1;		                        
		            parameters[31].Value = item.T2;		                        
		            parameters[32].Value = item.T3;		                        
		            parameters[33].Value = item.T4;		                        
		            parameters[34].Value = item.T5;		            		            
	            command.CommandText = strSql.ToString();
	         	command.Parameters = parameters;
	         	commands.Add(command);
	         }
            
            int rows=DbHelperSQL.ExecuteSqlTran(commands);
			return rows;

		}
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(XQ.SP.Model.ShopUserSetItem model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update [ShopUserSet] set ");
			                                                
            strSql.Append(" [UserInfoId] = @UserInfoId , ");                                    
            strSql.Append(" [WebName] = @WebName , ");                                    
            strSql.Append(" [Keys] = @Keys , ");                                    
            strSql.Append(" [Description] = @Description , ");                                    
            strSql.Append(" [Logo] = @Logo , ");                                    
            strSql.Append(" [BackColor] = @BackColor , ");                                    
            strSql.Append(" [Url] = @Url , ");                                    
            strSql.Append(" [RealName] = @RealName , ");                                    
            strSql.Append(" [BankName] = @BankName , ");                                    
            strSql.Append(" [BankStartPlace] = @BankStartPlace , ");                                    
            strSql.Append(" [BankNo] = @BankNo , ");                                    
            strSql.Append(" [Level] = @Level , ");                                    
            strSql.Append(" [Status] = @Status , ");                                    
            strSql.Append(" [Creator] = @Creator , ");                                    
            strSql.Append(" [Created] = @Created , ");                                    
            strSql.Append(" [Modifier] = @Modifier , ");                                    
            strSql.Append(" [Modified] = @Modified , ");                                    
            strSql.Append(" [OfficePhone] = @OfficePhone , ");                                    
            strSql.Append(" [Telephone] = @Telephone , ");                                    
            strSql.Append(" [WeChat] = @WeChat , ");                                    
            strSql.Append(" [QqGroup] = @QqGroup , ");                                    
            strSql.Append(" [QQ] = @QQ , ");                                    
            strSql.Append(" [IdImage] = @IdImage , ");                                    
            strSql.Append(" [IdCard] = @IdCard , ");                                    
            strSql.Append(" [Tele400] = @Tele400 , ");                                    
            strSql.Append(" [NoPublic] = @NoPublic , ");                                    
            strSql.Append(" [QQ1] = @QQ1 , ");                                    
            strSql.Append(" [QQ2] = @QQ2 , ");                                    
            strSql.Append(" [QQ3] = @QQ3 , ");                                    
            strSql.Append(" [T1] = @T1 , ");                                    
            strSql.Append(" [T2] = @T2 , ");                                    
            strSql.Append(" [T3] = @T3 , ");                                    
            strSql.Append(" [T4] = @T4 , ");                                    
            strSql.Append(" [T5] = @T5  ");            			
			strSql.Append(" where [Id]=@Id  ");
						
			SqlParameter[] parameters = {
			            new SqlParameter("@Id", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@UserInfoId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@WebName", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@Keys", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@Description", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@Logo", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BackColor", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Url", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@RealName", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BankName", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BankStartPlace", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@BankNo", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Level", SqlDbType.Int,4) ,            
                        new SqlParameter("@Status", SqlDbType.Int,4) ,            
                        new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Created", SqlDbType.DateTime) ,            
                        new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Modified", SqlDbType.DateTime) ,            
                        new SqlParameter("@OfficePhone", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Telephone", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@WeChat", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QqGroup", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@IdImage", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@IdCard", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@Tele400", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@NoPublic", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ1", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ2", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@QQ3", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T1", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T2", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T3", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T4", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@T5", SqlDbType.NVarChar,200)             
              
            };
            			            
            parameters[0].Value = model.Id;                        
            parameters[1].Value = model.UserInfoId;                        
            parameters[2].Value = model.WebName;                        
            parameters[3].Value = model.Keys;                        
            parameters[4].Value = model.Description;                        
            parameters[5].Value = model.Logo;                        
            parameters[6].Value = model.BackColor;                        
            parameters[7].Value = model.Url;                        
            parameters[8].Value = model.RealName;                        
            parameters[9].Value = model.BankName;                        
            parameters[10].Value = model.BankStartPlace;                        
            parameters[11].Value = model.BankNo;                        
            parameters[12].Value = model.Level;                        
            parameters[13].Value = model.Status;                        
            parameters[14].Value = model.Creator;                        
            parameters[15].Value = model.Created;                        
            parameters[16].Value = model.Modifier;                        
            parameters[17].Value = model.Modified;                        
            parameters[18].Value = model.OfficePhone;                        
            parameters[19].Value = model.Telephone;                        
            parameters[20].Value = model.WeChat;                        
            parameters[21].Value = model.QqGroup;                        
            parameters[22].Value = model.QQ;                        
            parameters[23].Value = model.IdImage;                        
            parameters[24].Value = model.IdCard;                        
            parameters[25].Value = model.Tele400;                        
            parameters[26].Value = model.NoPublic;                        
            parameters[27].Value = model.QQ1;                        
            parameters[28].Value = model.QQ2;                        
            parameters[29].Value = model.QQ3;                        
            parameters[30].Value = model.T1;                        
            parameters[31].Value = model.T2;                        
            parameters[32].Value = model.T3;                        
            parameters[33].Value = model.T4;                        
            parameters[34].Value = model.T5;                        
            int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
		
		
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(long Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ShopUserSet ");
			strSql.Append(" where Id=@Id  ");
						SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = Id;


			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
				/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool DeleteList(string Idlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ShopUserSet ");
			strSql.Append(" where Id in ("+Idlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
				
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopUserSetItem GetModel(long Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select Id, UserInfoId, WebName, Keys, Description, Logo, BackColor, Url, RealName, BankName, BankStartPlace, BankNo, Level, Status, Creator, Created, Modifier, Modified, OfficePhone, Telephone, WeChat, QqGroup, QQ, IdImage, IdCard, Tele400, NoPublic, QQ1, QQ2, QQ3, T1, T2, T3, T4, T5  ");			
			strSql.Append("  from ShopUserSet ");
			strSql.Append(" where Id=@Id  ");
						SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = Id;

			
			XQ.SP.Model.ShopUserSetItem model=new XQ.SP.Model.ShopUserSetItem();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			
			if(ds.Tables[0].Rows.Count>0)
			{
												if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=long.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["UserInfoId"].ToString()!="")
				{
					model.UserInfoId=long.Parse(ds.Tables[0].Rows[0]["UserInfoId"].ToString());
				}
																																				model.WebName= ds.Tables[0].Rows[0]["WebName"].ToString();
																																model.Keys= ds.Tables[0].Rows[0]["Keys"].ToString();
																																model.Description= ds.Tables[0].Rows[0]["Description"].ToString();
																																model.Logo= ds.Tables[0].Rows[0]["Logo"].ToString();
																																model.BackColor= ds.Tables[0].Rows[0]["BackColor"].ToString();
																																model.Url= ds.Tables[0].Rows[0]["Url"].ToString();
																																model.RealName= ds.Tables[0].Rows[0]["RealName"].ToString();
																																model.BankName= ds.Tables[0].Rows[0]["BankName"].ToString();
																																model.BankStartPlace= ds.Tables[0].Rows[0]["BankStartPlace"].ToString();
																																model.BankNo= ds.Tables[0].Rows[0]["BankNo"].ToString();
																												if(ds.Tables[0].Rows[0]["Level"].ToString()!="")
				{
					model.Level=int.Parse(ds.Tables[0].Rows[0]["Level"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Status"].ToString()!="")
				{
					model.Status=int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Creator"].ToString()!="")
				{
					model.Creator=long.Parse(ds.Tables[0].Rows[0]["Creator"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Created"].ToString()!="")
				{
					model.Created=DateTime.Parse(ds.Tables[0].Rows[0]["Created"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modifier"].ToString()!="")
				{
					model.Modifier=long.Parse(ds.Tables[0].Rows[0]["Modifier"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modified"].ToString()!="")
				{
					model.Modified=DateTime.Parse(ds.Tables[0].Rows[0]["Modified"].ToString());
				}
																																				model.OfficePhone= ds.Tables[0].Rows[0]["OfficePhone"].ToString();
																																model.Telephone= ds.Tables[0].Rows[0]["Telephone"].ToString();
																																model.WeChat= ds.Tables[0].Rows[0]["WeChat"].ToString();
																																model.QqGroup= ds.Tables[0].Rows[0]["QqGroup"].ToString();
																																model.QQ= ds.Tables[0].Rows[0]["QQ"].ToString();
																																model.IdImage= ds.Tables[0].Rows[0]["IdImage"].ToString();
																																model.IdCard= ds.Tables[0].Rows[0]["IdCard"].ToString();
																																model.Tele400= ds.Tables[0].Rows[0]["Tele400"].ToString();
																																model.NoPublic= ds.Tables[0].Rows[0]["NoPublic"].ToString();
																																model.QQ1= ds.Tables[0].Rows[0]["QQ1"].ToString();
																																model.QQ2= ds.Tables[0].Rows[0]["QQ2"].ToString();
																																model.QQ3= ds.Tables[0].Rows[0]["QQ3"].ToString();
																																model.T1= ds.Tables[0].Rows[0]["T1"].ToString();
																																model.T2= ds.Tables[0].Rows[0]["T2"].ToString();
																																model.T3= ds.Tables[0].Rows[0]["T3"].ToString();
																																model.T4= ds.Tables[0].Rows[0]["T4"].ToString();
																																model.T5= ds.Tables[0].Rows[0]["T5"].ToString();
																										
				return model;
			}
			else
			{
				return null;
			}
		}
		
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopUserSetItem GetModelWhereStr(string whereStr)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select Id, UserInfoId, WebName, Keys, Description, Logo, BackColor, Url, RealName, BankName, BankStartPlace, BankNo, Level, Status, Creator, Created, Modifier, Modified, OfficePhone, Telephone, WeChat, QqGroup, QQ, IdImage, IdCard, Tele400, NoPublic, QQ1, QQ2, QQ3, T1, T2, T3, T4, T5  ");			
			strSql.Append("  from ShopUserSet ");
            if (whereStr != "")
            {
                strSql.Append(" where "+whereStr);
            }
			
			XQ.SP.Model.ShopUserSetItem model=new XQ.SP.Model.ShopUserSetItem();
			DataSet ds=DbHelperSQL.Query(strSql.ToString());
			
			if(ds.Tables[0].Rows.Count>0)
			{
												if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=long.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["UserInfoId"].ToString()!="")
				{
					model.UserInfoId=long.Parse(ds.Tables[0].Rows[0]["UserInfoId"].ToString());
				}
																																				model.WebName= ds.Tables[0].Rows[0]["WebName"].ToString();
																																model.Keys= ds.Tables[0].Rows[0]["Keys"].ToString();
																																model.Description= ds.Tables[0].Rows[0]["Description"].ToString();
																																model.Logo= ds.Tables[0].Rows[0]["Logo"].ToString();
																																model.BackColor= ds.Tables[0].Rows[0]["BackColor"].ToString();
																																model.Url= ds.Tables[0].Rows[0]["Url"].ToString();
																																model.RealName= ds.Tables[0].Rows[0]["RealName"].ToString();
																																model.BankName= ds.Tables[0].Rows[0]["BankName"].ToString();
																																model.BankStartPlace= ds.Tables[0].Rows[0]["BankStartPlace"].ToString();
																																model.BankNo= ds.Tables[0].Rows[0]["BankNo"].ToString();
																												if(ds.Tables[0].Rows[0]["Level"].ToString()!="")
				{
					model.Level=int.Parse(ds.Tables[0].Rows[0]["Level"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Status"].ToString()!="")
				{
					model.Status=int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Creator"].ToString()!="")
				{
					model.Creator=long.Parse(ds.Tables[0].Rows[0]["Creator"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Created"].ToString()!="")
				{
					model.Created=DateTime.Parse(ds.Tables[0].Rows[0]["Created"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modifier"].ToString()!="")
				{
					model.Modifier=long.Parse(ds.Tables[0].Rows[0]["Modifier"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modified"].ToString()!="")
				{
					model.Modified=DateTime.Parse(ds.Tables[0].Rows[0]["Modified"].ToString());
				}
																																				model.OfficePhone= ds.Tables[0].Rows[0]["OfficePhone"].ToString();
																																model.Telephone= ds.Tables[0].Rows[0]["Telephone"].ToString();
																																model.WeChat= ds.Tables[0].Rows[0]["WeChat"].ToString();
																																model.QqGroup= ds.Tables[0].Rows[0]["QqGroup"].ToString();
																																model.QQ= ds.Tables[0].Rows[0]["QQ"].ToString();
																																model.IdImage= ds.Tables[0].Rows[0]["IdImage"].ToString();
																																model.IdCard= ds.Tables[0].Rows[0]["IdCard"].ToString();
																																model.Tele400= ds.Tables[0].Rows[0]["Tele400"].ToString();
																																model.NoPublic= ds.Tables[0].Rows[0]["NoPublic"].ToString();
																																model.QQ1= ds.Tables[0].Rows[0]["QQ1"].ToString();
																																model.QQ2= ds.Tables[0].Rows[0]["QQ2"].ToString();
																																model.QQ3= ds.Tables[0].Rows[0]["QQ3"].ToString();
																																model.T1= ds.Tables[0].Rows[0]["T1"].ToString();
																																model.T2= ds.Tables[0].Rows[0]["T2"].ToString();
																																model.T3= ds.Tables[0].Rows[0]["T3"].ToString();
																																model.T4= ds.Tables[0].Rows[0]["T4"].ToString();
																																model.T5= ds.Tables[0].Rows[0]["T5"].ToString();
																										
				return model;
			}
			else
			{
				return null;
			}
		}
		
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select * ");
			strSql.Append(" FROM ShopUserSet ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}
		
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" * ");
			strSql.Append(" FROM ShopUserSet ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}
		
	}
}

